package com.factory._15chain.example;

/**
 * @author Qinye
 * @date 2023/8/13 17:31
 */
public class Test {
    public static void main(String[] args) {
        //创建一个请求
        ApproverRequest approveRequest = new ApproverRequest(1, 31000, 1);
        //创建相关的审批人
        DepartmentApprover departmentApprover = new DepartmentApprover("张主任");
        CollegeApprover collegeApprover = new CollegeApprover("李院长");
        ViceSchoolMasterApprover viceSchoolMasterApprover = new ViceSchoolMasterApprover("王副校");
        SchoolMasterApprover schoolMasterApprover = new SchoolMasterApprover("佟校长");

        //需要将各个审批级别的下一个设置好
        departmentApprover.setApprover(collegeApprover);
        collegeApprover.setApprover(viceSchoolMasterApprover);
        viceSchoolMasterApprover.setApprover(schoolMasterApprover);
        //单向责任链这里可以不加
//        schoolMasterApprover.setApprover(departmentApprover);

        departmentApprover.processRequest(approveRequest);
        viceSchoolMasterApprover.processRequest(approveRequest);
    }
}
